
#ifndef ELEVATOR_H
#define ELEVATOR_H

#include "WeightSensor.h"
#include "DoorSensor.h"
#include "List.h"
#include "Destination.h"

#include "ntk_vs.h"

struct Elevator
{
	int currentFloor;
	int status;
	int elevatorId;
	List *destinations;

	WeightSensor *weightSensor;
	DoorSensor *doorSensor;

	STD *stateMachine;
	mailBox elevatorMailbox;
	task *elevatorController;
};

typedef enum {
	idle,
	doorClosed,
	doorOpen,
	moving
} elevatorStatus;

typedef enum {
	openingDoor,
	closingDoor,
	move,
	stopping,
	goIdle
} elevatorEvent;

typedef struct Elevator Elevator;

Elevator* elevatorConstruct(int elevatorId);
void elevatorDeconstruct(Elevator *elevator);
void elevatorAddDestination(Elevator *elevator, Destination *destination);
void elevatorSendEvent(Elevator *elevator, elevatorEvent eventToExecute);
void elevatorCallEmergency(Elevator *elevator, int numberToCall);
#endif